package demo2;

public class SubSupDemo {
    public static void main(String[] args) {
        Student stu1 = new Student( ) ;
        Student stu2 = new Student( "夏兰", 23 ) ;
        stu2.display();
    }
}

class Person{
    String name;
    int age;
    public Person( ) {
        System.out.println( "Person()被调用");
    }
    public Person(String newName){
        name = newName;
        System. out.println( "Person( String)被调用");
    }
    public void display(){
        System. out. println("姓名: " + name + "，年龄:"+ age) ;}
}

class Student extends Person {
    public Student() {
        System.out.println("Student()被调用");
    }
    public Student(String newName, int newAge){
        super(newName);
        super.age = newAge;
    }
}
